<?php

declare(strict_types=1);
/**
 * @copyright 深圳市易果网络科技有限公司
 * @version 1.0.0
 * @link https://dayiguo.com
 */

namespace App\Controller\business;

use App\Middleware\User\UserMiddleware;
use App\Service\Business\RecommendService;

use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\AutoController;
use Hyperf\HttpServer\Annotation\Middleware;
use Hyperf\Snowflake\IdGeneratorInterface;
use Hyperf\Utils\ApplicationContext;

/**
 * 推荐返点控制器
 * @AutoController()
 * @Middleware(UserMiddleware::class)
 * @author eug(1196070838@qq.com)
 * @package App\Controller\business
 */
class RecommendController extends Controller
{
    /**
     * 注入推荐返点服务
     *
     * @Inject
     *
     * @var RecommendService
     */
    private $service;

    /**
     * 获取用户身份（会员、渠道商、商家）
     */
    public function get_user_info()
    {
        $result = $this->service->getUserInfo();

        $this->success($result);
    }

    /**
     * 获取分享会员的信息（姓名、手机号、消费金额、积分）
     */
    public function get_share_info()
    {
        $result = $this->service->getShareInfo();

        $this->success($result);
    }

    /**
     * 统计用户分享了多少会员
     */
    public function count_member()
    {
        $result = $this->service->countMember();

        $this->success($result);
    }

    /**
     * 统计用户分享了多少商家
     */
    public function count_business()
    {
        $result = $this->service->countBusiness();

        $this->success($result);
    }

    /**
     * 统计用户分享的会员为他带来积分收益的明细列表
     */
    public function get_integral_by_member()
    {
        $result = $this->service->getIntegralByMember();

        $this->success($result);
    }
}